import {defineStore} from 'pinia'
import { ICardItem } from '@/type/interface'

export const useGlobalStore = defineStore('global', {
    state: () => ({
        //瀑布流每行展示的数量
        templateNum: 5,
        //侧边栏宽度
        sideWidth:'0px',
        //间距
        gap:32,
        //容器高度
        clientHeight:0,
        //卡片的宽度
        cardWidth:240,
        //卡片数组
        cardList: [] as ICardItem[],
    }),
    actions: {
        setTemplateNum(val:number){
            this.templateNum = val
        },
        setSideWidth(val:string){
            this.sideWidth = val
        },
        setGapWidth(val: number){
            this.gap = val
        },
        setClientHeight(val:number){
            this.clientHeight = val
        },
        setCardWidth(val:number){
            this.cardWidth = val
        },
        setCardList(val: ICardItem[]){
            this.cardList = val
        },
    }
})